package java44th.group.service.admin.json;

import java44th.group.bean.json.ChildrenDTO;
import java44th.group.bean.json.ChildrenDTOX;
import java44th.group.bean.json.DataDTO;
import java44th.group.bean.json.SystemPermissionsDTO;
import java44th.group.mapper.MarketPermissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Aurhor: 王可龙
 * @DATE: 2022/10/14 12:06
 * @Package:java44th.group.service.admin.json
 * @Description:
 * @Version 1.0
 */
@Service
public class JsonServiceImmpl implements JsonService {


    @Autowired
    MarketPermissionMapper marketPermissionMapper;


    @Override
    public void insert(DataDTO dataDTO) {
        List<SystemPermissionsDTO> systemPermissions = dataDTO.getSystemPermissions();
        for (SystemPermissionsDTO systemPermission : systemPermissions) {
            List<ChildrenDTOX> children = systemPermission.getChildren();
            for (ChildrenDTOX child : children) {
                List<ChildrenDTO> children1 = child.getChildren();
                for (ChildrenDTO childrenDTO : children1) {
                    marketPermissionMapper.insertPermisssionDataOne(systemPermission,child,childrenDTO);
                }
            }
        }
    }
}
